  

<div class="subhead">Change Password</div>
<div class="bodywrap">
  <div class="cont">
 <div class="formcss">              
  <div class="errormessage" id="retype" style="color:red;"></div>              
 <?php 
	$model=Users::model()->findByPk($id);
	 echo "Username: ".$model->username;
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'users-form',
	'enableAjaxValidation'=>false,
)); ?>


<?php echo CHtml::beginForm(); ?>
	<?php //echo CHtml::errorSummary($model); ?>
	 
	<div class="row">
	
	<?php echo $form->textField($model,'password',array('value'=>'Password','onfocus'=>'setfields("Users_password")')); ?>
	</div>
	
	<div class="row">
   
      <input type="text" id="verifyPassword" name="verifyPassword" value="Re-Type Password" onfocus="setfields('verifyPassword')">
	</div>
	
	
	<div class="row submit">
	<?php echo CHtml::submitButton('Save',array('onclick'=>'return checkpassword()')); ?>
	</div>
<?php echo CHtml::endForm(); ?>
<?php $this->endWidget(); ?>
</div><!-- form -->
  <script type="text/javascript">
function setfields($id)
{
	document.getElementById($id).value="";
	if($id=="Users_password" || $id=="verifyPassword")
	{
		document.getElementById($id).type="password";
	}
}
function checkpassword()
{
   pass1=document.getElementById("Users_password").value;
   pass2=document.getElementById("verifyPassword").value;
   if(pass1==pass2){
    return true;
    }
    else{
     
    document.getElementById('retype').innerHTML="Re-type password must be same as password";
    return false;
     }

}

</script>   
  </div> 
    </div>
    </div>
           
                
 
